<template>
    <div class="list">
        <div class="title">{{companyInfo.company_name}}</div>
        <Row class="ess-info">
            <Col span="24">基本信息</Col>
        </Row>
        <br>
        <Row>
            <Col span="1"></Col>
            <Col span="3">跟进人</Col>
            <Col span="20">{{companyInfo.liais_name}}</Col>
        </Row>
        <br>
        <Row>
            <Col span="1"></Col>
            <Col span="3">公司电话</Col>
            <Col span="8">{{companyInfo.tel}}</Col>
            <Col span="3">公司邮编</Col>
            <Col span="9">{{companyInfo.zip_code}}</Col>
        </Row>
        <br>
        <Row>
            <Col span="1"></Col>
            <Col span="3">公司地址</Col>
            <Col span="20">{{companyInfo.address}}</Col>
        </Row>
        <br>
        <Row class="ess-info">
            <Tabs value="name2">
                <TabPane label="联系人" name="name1">空空空</TabPane>
                <TabPane label="跟进记录" name="name2">
                    <liaison_list @get_ok_list="get_ok_list" :cid="companyInfo.id"></liaison_list>
                    <liaison_list_complete ref="liaison_list_complete"></liaison_list_complete>
                </TabPane>
            </Tabs>
        </Row>
        <br>
    </div>
</template>
<style>
    .list{position: relative;}
    .title{font-size:20px;font-weight:900;text-align:left;margin-bottom:20px;padding-left:20px;}
    .ess-info{background: inherit;font-weight:900;background-color: rgba(2, 125, 180, 0.07);height:40px;line-height:40px;text-align:left;padding-left:20px;}
    .list .ivu-col{text-align:left;}
</style>
<script>
    import liaison_list from './LiaisonList.vue'
    import liaison_list_complete from './LiaisonListComplete.vue'
    export default {
        components: {liaison_list, liaison_list_complete},
        data() {
            return {
                companyInfo: {
                    id: '',
                    company_name: '',
                    liais_name: '',
                    tel: '',
                    zip_code: '',
                    address: ''
                }
            }
        },
        methods: {
            get_company_info: function(cid) {
                let that = this
                this.$http.get('http://jorren-api.iccchina.com/company/customer/get_customer_info',{params:{cid: cid}})
                .then(function(data) {
                    that.companyInfo = data.data.info
                }, function(error) {
                    console.log(error)
                })
            },
            go_detail: function(e) {
                this.$router.push({path:'/company_detail',query: {cid:e.id}})
            },
            get_ok_list(cid) {
                this.$refs.liaison_list_complete.get_ok_list(cid)
            }
        },
        created() {
            let cid = this.$route.query.cid;
            this.get_company_info(cid);
        }
    }
    
</script>
